# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=shared-mime-info

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.2
pkgrel=1
pkgdesc="Freedesktop.org Shared MIME Info"
arch=('any')
license=('GPL')
depends=("${MINGW_PACKAGE_PREFIX}-libxml2" "${MINGW_PACKAGE_PREFIX}-glib2")
makedepends=('intltool' "${MINGW_PACKAGE_PREFIX}-pkg-config" "${MINGW_PACKAGE_PREFIX}-gettext")
[[ $MINGW_CHOST == i686-w64-mingw32 ]] && {
  install=shared-mime-info32.install
} || {
  install=shared-mime-info64.install
}
#install=shared-mime-info.install
url="http://freedesktop.org/Software/shared-mime-info"
source=(http://freedesktop.org/~hadess/${_realname}-${pkgver}.tar.xz
    program.manifest)
md5sums=('8f90f3f2b8478fa47e70678d34013f99'
         '747922367f2aca376cb7f23d06dc111e')
options=(!makeflags)

build() {
  mkdir ${srcdir}/build-${MINGW_CHOST}
  cd ${srcdir}/build-${MINGW_CHOST}
  "${srcdir}/${_realname}-${pkgver}"/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --disable-update-mimedb
  make
}

check() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make -k check
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR="${pkgdir}" install
  install -Dm644 ${srcdir}/program.manifest ${pkgdir}${MINGW_PREFIX}/bin/update-mime-database.exe.manifest
  sed -e "s|%PROGNAME%|GNU.update-mime-database}|g" \
      -i ${pkgdir}${MINGW_PREFIX}/bin/update-mime-database.exe.manifest
}
